Revert changes in revision r1921.

--- src/session-child.c.orig	2014-09-03 07:19:58 UTC
+++ src/session-child.c
@@ -13,7 +13,9 @@
 #include <grp.h>
 #include <glib.h>
 #include <security/pam_appl.h>
+#if HAVE_UTMP_H
 #include <utmp.h>
+#endif
 #include <utmpx.h>
 #include <sys/mman.h>
 
@@ -197,6 +199,7 @@
     return x_authority_new (x_authority_family, x_authority_address, x_authority_address_length, x_authority_number, x_authority_name, x_authority_data, x_authority_data_length);
 }
 
+#if HAVE_UTMP_H
 /* GNU provides this but we can't rely on that so let's make our own version */
 static void
 updwtmpx (const gchar *wtmp_file, struct utmpx *ut)
@@ -219,6 +222,7 @@
   
     updwtmp (wtmp_file, &u);
 }
+#endif
 
 int
 session_child_run (int argc, char **argv)
@@ -360,6 +364,7 @@
         g_free (username);
         username = g_strdup (new_username);
 
+#if HAVE_UTMP_H
         /* Write record to btmp database */
         if (authentication_result == PAM_AUTH_ERR)
         {
@@ -387,6 +392,7 @@
 
             updwtmpx ("/var/log/btmp", &ut);
         }
+#endif
 
         /* Check account is valid */
         if (authentication_result == PAM_SUCCESS)
@@ -700,7 +706,9 @@
             if (!pututxline (&ut))
                 g_printerr ("Failed to write utmpx: %s\n", strerror (errno));
             endutxent ();
+#if HAVE_UTMP_H
             updwtmpx ("/var/log/wtmp", &ut);
+#endif
         }
 
         waitpid (child_pid, &return_code, 0);
@@ -736,7 +744,9 @@
             if (!pututxline (&ut))
                 g_printerr ("Failed to write utmpx: %s\n", strerror (errno));
             endutxent ();
+#if HAVE_UTMP_H
             updwtmpx ("/var/log/wtmp", &ut);
+#endif
         }
     }
 
